package kr.pe.johnkim.carrotpoint.mobile.service;

import kr.pe.johnkim.carrotpoint.mobile.dao.CarrotPointMemberPointLogDao;
import kr.pe.johnkim.carrotpoint.mobile.domain.CarrotPointMemberPointLog;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * Carrot Point 사용자 포인트 로그 관련 service 클래스 이다.
 *
 * @author : John_Kim <cale9797@gmail.com>
 * @date : 13. 2. 6.
 */
@Service
public class CarrotPointMemberPointLogServiceImpl implements CarrotPointMemberPointLogService {

    // SLF4J Logging
    private Logger logger = LoggerFactory.getLogger(CarrotPointMemberPointLogServiceImpl.class);

    @Autowired
    private CarrotPointMemberPointLogDao carrotPointMemberPointLogDao;

    /**
     * 포인트 로그를 등록 한다.
     *
     * @param carrotPointMemberPointLog
     */
    @Override
    public void registerMemberPointLog(CarrotPointMemberPointLog carrotPointMemberPointLog) {
        logger.info("registerMemberPointLog");
        carrotPointMemberPointLogDao.registerMemberPointLog(carrotPointMemberPointLog);
    }

    /**
     * 포인트 아이디로 포인트 로그 목록을 가져 온다.
     *
     * @param carrotPointMemberPointLog
     * @return
     */
    @Override
    public List<CarrotPointMemberPointLog> getMemberPointLogList(CarrotPointMemberPointLog carrotPointMemberPointLog) {
        logger.info("getMemberPointLogList");
        return carrotPointMemberPointLogDao.getMemberPointLogList(carrotPointMemberPointLog);
    }

    /**
     * 포인트 로그 내용을 가져 온다.
     *
     * @param carrotPointMemberPointLog
     * @return
     */
    @Override
    public CarrotPointMemberPointLog getMemberPointLogInformation(CarrotPointMemberPointLog carrotPointMemberPointLog) {
        logger.info("getMemberPointLogInformation");
        return carrotPointMemberPointLogDao.getMemberPointLogInformation(carrotPointMemberPointLog);
    }

    /**
     * 포인트 로그 활성화 여부를 업데이트 한다.
     *
     * @param carrotPointMemberPointLog
     */
    @Override
    public void updateMemberPointLogActivateYn(CarrotPointMemberPointLog carrotPointMemberPointLog) {
        logger.info("updateMemberPointLogActivateYn");
        carrotPointMemberPointLogDao.updateMemberPointLogActivateYn(carrotPointMemberPointLog);
    }
}
